<template>
  <div id="home">
    <div class="home_shang_hei">
      <span>请先登录</span>
      <span>免费注册</span>
      <span>我的订单</span>
      <span>会员中心</span>
      <span>帮助中心</span>
      <span>关于我们</span>
      <span>手机版</span>
    </div>
    <div class="home_shang_biao">
      <div class="home_shang_biao_xin">
        <img src="@/assets/img/logo.0940ebb5.png" alt="">
        <ul class="home_shang_ul">
          <li class="home_ul_yin">首页</li>
          <li v-for="(item, index) in catelist" :key="index" class="home_ul_yin"><span class="flagg"></span>{{ item.name
          }}
            <!-- 隐藏层 -->
            <div class="shang_biao_tian">
              <ul>
                <li v-for="it in item.children" :key="it.id">
                  <img :src="it.picture" alt="">
                  <p>{{ it.name }}</p>
                </li>
              </ul>
            </div>
          </li>

        </ul>
        <div class="biao_xin_zuo">
          <input type="text" placeholder="搜一搜">
        </div>
        <div class="biao_xin_you">

        </div>
      </div>
    </div>
    <!-- 轮播图部分 -->
    <ImageMin>
      
    </ImageMin>
    <!-- 划块 -->
    <div class="home_zhong_hua" style="top:this.top">
      <img src="@/assets/img/logo.0940ebb5.png" alt="">
      <ul class="home_shang_ull">
        <li class="home_ul_yin">首页</li>
        <li v-for="(item, index) in catelist" :key="index" class="home_ul_yin"><span class="flagg"></span>{{ item.name
        }}
          <!-- 隐藏层 -->
          <div class="shang_biao_tiann">
            <ul>
              <li v-for="it in item.children" :key="it.id">
                <img :src="it.picture" alt="">
                <p>{{ it.name }}</p>
              </li>
            </ul>
          </div>
        </li>
        <span class="aqq"></span>
        <li class="home_ul_yin">品牌</li>
        <li class="home_ul_yin">专题</li>
      </ul>
    </div>
    <div>
      <p>1</p>
      <p>1</p>
      <p>1</p>
      <p>1</p>
      <p>1</p>
      <p>1</p>
      <p>1</p>
      <p>1</p>
      <p>1</p>
      <p>1</p>
      <p>1</p>
      <p>1</p>
      <p>1</p>
      <p>1</p>
      <p>1</p>
      <p>1</p>
      <p>1</p>
      <p>1</p>
      <p>1</p>
      <p>1</p>
      <p>1</p>
      <p>1</p>
      <p>1</p>
      <p>1</p>
      <p>1</p>
      <p>1</p>
      <p>1</p>
      <p>1</p>
      <p>1</p>
      <p>1</p>
      <p>1</p>
      <p>1</p>
      <p>1</p>
      <p>1</p>
      <p>1</p>
      <p>1</p>
      <p>1</p>
      <p>1</p>
      <p>1</p>
      <p>1</p>
      <p>1</p>
      <p>1</p>
      <p>1</p>
      <p>1</p>
      <p>1</p>
      <p>1</p>
      <p>1</p>
      <p>1</p>
      <p>1</p>
      <p>1</p>
      <p>1</p>
      <p>1</p>
      <p>1</p>
      <p>1</p>
      <p>1</p>
      <p>1</p>
      <p>1</p>
      <p>1</p>
      <p>1</p>
      <p>1</p>
      <p>1</p>
      <p>1</p>
      <p>1</p>
      <p>1</p>
      <p>1</p>
      <p>1</p>
      <p>1</p>
      <p>1</p>
      <p>1</p>
      <p>1</p>
      <p>1</p>
      <p>1</p>
      <p>1</p>
      <p>1</p>
      <p>1</p>
      <p>1</p>
      <p>1</p>
      <p>1</p>
      <p>1</p>
      <p>1</p>
      <p>1</p>
      <p>1</p>
      <p>1</p>
      <p>1</p>
      <p>1</p>
      <p>1</p>
      <p>1</p>
      <p>1</p>
      <p>1</p>
      <p>1</p>
      <p>1</p>
      <p>1</p>
    </div>

  </div>
</template>

<script>
import ImageMin from "@/components/mellod/ImageMin"

// import {throttle} from "@/utils/request"
import _ from "lodash"
export default {
  components: { ImageMin },
  data() {
    return {
      top: 0
    }
  },
  mounted() {
    // this.$store.dispatch("classify/asyncSetCate")
    // var obj=document.querySelector('#home')
    // console.log(obj);
    // obj.addEventListener('scroll',(e)=>{
    //   console.log(e);
    //   if(e.timeStamp>3000){
    //     console.log(11);
    //     this.flag=true
    //     console.log(this.flag);
    //   }else{
    //     this.flag=false
    //   }
    // })
    window.addEventListener('scroll', _.throttle(this.setTop, 200))
  },
  computed: {
    catelist() {
      return this.$store.state.classify.cate
    },

  },
  methods: {
    setTop() {
      this.top = document.documentElement.scrollTop
      console.log(document.documentElement.scrollTop);
    }
  }
}
</script>
<style lang="scss">
@import "../assets/mixin";

// span{
//   @include hoverShadow
// }
#home {
  width: 100%;
  height: 100%;
  overflow: auto;
  position: relative;

  .home_shang_hei {
    width: 100%;
    height: 53px;
    display: flex;
    align-items: center;
    background: #333333;
    display: flex;
    justify-content: flex-end;
    padding-right: 230px;

    span {
      color: #cdcdcd;
      padding: 0 15px;
      font-size: 14px;
      height: 14px;
      display: inline-block;
      // background: red;
      border-right: 2px solid #666666;
      line-height: 14px;
    }

    span:last-child {
      border: none;
    }

    span:hover {
      color: #27ba9b;
    }
  }

  .home_shang_biao {
    width: 100%;
    height: 132px;
    // position: relative;
    // background: blueviolet;

    .home_shang_biao_xin {
      width: 1200px;
      height: 100%;
      // background: goldenrod;
      margin: auto;
      display: flex;
      justify-content: space-around;
      align-items: center;

      img {
        width: 200px;
        height: 90px;
      }

      .home_shang_ul {
        width: 820px;
        height: 100%;
        padding-left: 40px;
        display: flex;
        justify-content: space-around;

        .home_ul_yin {
          margin-right: 40px;
          // position: relative;
          margin-top: 50px;
          font-size: 16px;
          line-height: 32px;
          height: 132px;
          width: 32px;


          .shang_biao_tian {
            position: absolute;
            top: 165px;
            left: 50%;
            // transform: translate(0,-600px);
            width: 1200px;
            height: 130px;
            box-shadow: 1px 1px 5px #666666;
            transform: translate(-600px, 0);
            display: none;
            background: white;
            color: black;

            ul {
              width: 40%;
              height: 100%;
              display: flex;
              align-items: center;

              li {
                flex: 1;
                padding-left: 15px;
                display: flex;
                justify-content: center;
                flex-wrap: wrap;
                align-content: space-around;

                img {
                  width: 80px;
                  height: 80px;
                }

                p {
                  font-size: 14px;
                }
              }
            }
          }
        }

        .home_ul_yin:hover .shang_biao_tian {
          display: block;
          z-index: 888;
          // transition: all .5s 5s;
        }

        .home_ul_yin:hover {
          color: #27ba9b;
          // border-bottom: 1px solid #27ba9b;
        }

        .home_ul_yin:hover .flagg {
          width: 32px;
          height: 32px;
          position: absolute;
          border-bottom: 1px solid #27ba9b;
        }

      }

      .biao_xin_zuo {
        width: 170px;
        height: 100%;
        display: flex;
        align-items: center;

        input {
          width: 100%;
          height: 32px;
          // background: #999;
          border: none;
          background-image: url(@/assets/img/Snipaste_2022-12-07_20-25-44.png);
          outline: none;
          background-size: 20px 20px;
          background-repeat: no-repeat;
          background-position: 6px;
          border-bottom: 1px solid #e7e7e7;
          padding-left: 27px;
        }
      }

      .biao_xin_you {
        width: 50px;
        height: 32px;
        background: yellow;
      }
    }

  }

  .home_zhong_hua {
    width: 100%;
    height: 80px;
    background: white;
    // margin: auto;
    padding-left: 260px;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    position: absolute;
    left: 0;

    // top: 0;
    img {

      width: 200px;
      height: 80px;
    }

    .home_shang_ull {
      width: 1000px;
      height: 80px;
      padding-left: 40px;
      display: flex;
      justify-content: space-around;
      line-height: 80px;

      .home_ul_yin {
        margin-right: 40px;
        // position: relative;
        margin-top: 24px;
        font-size: 16px;
        line-height: 32px;
        height: 132px;
        width: 32px;

      }

      .aqq {
        height: 20px;
        // position: relative;
        padding-right: 40px;
        margin-top: 30px;
        border-left: 2px solid #27ba9b;
      }

      .shang_biao_tiann {
        position: absolute;
        top: 80px;
        left: 50%;
        width: 1200px;
        height: 130px;
        box-shadow: 1px 1px 5px #666666;
        transform: translate(-600px, 0);
        display: none;
        background: white;
        color: black;
        z-index: 999;

        ul {
          width: 40%;
          height: 100%;
          display: flex;
          align-items: center;

          li {
            flex: 1;
            padding-left: 15px;
            display: flex;
            justify-content: center;
            flex-wrap: wrap;
            align-content: space-around;

            img {
              width: 80px;
              height: 80px;
            }

            p {
              font-size: 14px;
            }
          }

        }
      }

      .home_ul_yin:hover .shang_biao_tiann {
        display: block;
        z-index: 999;
        // transition: all .5s 5s;
      }

      .home_ul_yin:hover {
        color: #27ba9b;
        // border-bottom: 1px solid #27ba9b;
      }

      .home_ul_yin:hover .flagg {
        width: 32px;
        height: 32px;
        position: absolute;
        border-bottom: 1px solid #27ba9b;
      }

    }
  }

}
</style>
